package JaggSoft.Utilidades;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class DetectorPulsacionTeclas implements KeyListener {
    private ListaSugerida ls;
    public DetectorPulsacionTeclas(ListaSugerida ls) {
        this.ls=ls;
    }
    @Override
    public void keyTyped(KeyEvent e) {
        this.ls.setDatos(e.getKeyChar());
    }
    @Override
    public void keyPressed(KeyEvent e) {
        if(e.getKeyCode()==KeyEvent.VK_DOWN){
            if(ls.tieneElementos())
                ls.Mostrar();
            /*if(ls.getModel().getSize()>0){
                ls.setSelectedIndex(0);
                ls.requestFocus();
            }*/
        }
    }
    @Override
    public void keyReleased(KeyEvent e) {}
}